/*
 * Copyright 2008 Nathan C Jones
 * 
 * This file is part of Fivehundred.
 * 
 * Fivehundred is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 * 
 * Fivehundred is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * Fivehundred. If not, see <http://www.gnu.org/licenses/>. 
 */

package com.googlecode.fivehundred.svg;

import java.awt.Graphics2D;
import java.awt.Image;

import com.googlecode.fivehundred.model.Card;
import com.googlecode.fivehundred.model.Face;

/**
 * Renders face cards. Face cards have just one image in the center of the card.
 * 
 * @author Nathan C Jones
 */
public class FaceCardRenderer extends DynamicCardRenderer {

	public FaceCardRenderer(Card card) {
		super(card);
	}

	@Override
	protected void drawCardCenter(final Graphics2D g, final int width, final int height) {
		// TODO Auto-generated method stub
		int imageWidth = (int) (width - width * MARGIN_WIDTH * 2);
		if (getCard().getFace().equals(Face.Joker)) {
			Image image = getSvgImage(imageWidth, "joker.svg");
			final int x = (width - image.getWidth(null)) / 2;
			final int y = (height - image.getHeight(null)) / 2;
			g.drawImage(image, x, y, null);
		}
	}

}
